// [[ OnflowGenerator Entity UUID: 27e1d98ba75541a79c92c8c01e5d6451 ]]
package com.itdct.onflow.system.file.entity

import com.baomidou.mybatisplus.annotation.TableName
import com.itdct.onflow.core.annotation.Column
import com.itdct.onflow.core.annotation.ColumnRelateDict
import com.itdct.onflow.core.annotation.ColumnRelateId
import com.itdct.onflow.core.annotation.TableDescription
import com.itdct.onflow.core.entity.BaseUserEntity
import java.util.*

/**
 * @author Zhouwx
 * @date 2025/9/28 15:16:01
 * @version 1.0
 * @description
 */
@TableDescription("系统传输中心")
@TableName("sys_transfer_center")
class SysTransferCenterEntity : BaseUserEntity() {
    @Column(comment = "任务名称", nullable = false, length = 200, sort = 10, indexed = true, forSelect = true)
    var name = ""

    /**
     * 传输类型，分为0：文件下载，10：文件上传
     */
    @ColumnRelateDict(dictCode = "sysTransferCenterTransferType")
    @Column(comment = "传输类型", nullable = false, defaultValue = "0", sort = 20)
    var transferType = 0

    /**
     * 执行状态，分为0：待执行，10：执行中，20：执行成功，30：执行失败
     * 整个任务的执行状态
     */
    @ColumnRelateDict(dictCode = "sysTransferCenterExecuteState")
    @Column(comment = "执行状态", nullable = false, defaultValue = "0", sort = 30)
    var executeState = 0

    @ColumnRelateDict(dictCode = "platformType")
    @Column(comment = "平台类型", nullable = false, length = 50, defaultValue = "onflow-backend", indexed = true, sort = 40)
    var platformType = ""

    @ColumnRelateDict(dictCode = "sysModuleName")
    @Column(comment = "所属模块", nullable = false, length = 100, defaultValue = "", indexed = true, sort = 50)
    var moduleName = ""

    /**
     * 文件总数量
     */
    @Column(comment = "文件数量", nullable = false, defaultValue = "0", sort = 40)
    var fileCount = 0

    /**
     * 文件成功数量，比如导入多个文件，成功了多少个文件
     */
    @Column(comment = "成功数量", nullable = false, defaultValue = "0", sort = 50)
    var successCount = 0

    /**
     * 文件失败数量，比如导入多个文件，失败了多少个文件
     */
    @Column(comment = "失败数量", nullable = false, defaultValue = "0", sort = 60)
    var failCount = 0

    /**
     * 文件跳过数量，比如导入多个文件，跳过了多少个文件
     */
    @Column(comment = "跳过数量", nullable = false, defaultValue = "0", sort = 60)
    var skipCount = 0

    @Column(comment = "错误信息", nullable = true, length = 2000, sort = 70)
    var errorMessage: String? = null

    @Column(comment = "任务开始时间", sort = 80)
    var startTime: Date? = null

    @Column(comment = "任务结束时间", sort = 90)
    var finishTime: Date? = null

    @Column(comment = "任务所有文件打包下载地址", nullable = true, length = 600, sort = 100)
    var packageDownloadUrl: String? = null

    @ColumnRelateId(targetClass = SysFileEntity::class, targetFieldName = "fileName")
    @Column(comment = "任务所有文件打包zip文件id", nullable = true, sort = 110)
    var packageDownloadFileId: Long? = null


}